package org.scc.service;

import org.scc.dao.PrayerDao;
import org.scc.model.Prayer;
import org.scc.vo.PageVO;

public class PrayerService {
	private PrayerDao prayerDao;
	
	public PrayerService(){
		prayerDao = new PrayerDao();
	}
	
	public void add(Prayer prayer){
		prayerDao.add(prayer);
	}
	
	public void update(Prayer prayer){
		prayerDao.update(prayer);
	}
	
	public void delete(String ids){
		prayerDao.delete(ids);
	}
	
	public PageVO<Prayer> findByUser(int userId, int rowBeginIndex, int rowCount){
		PageVO<Prayer> pageVO = new PageVO<Prayer>();
		pageVO.setTotal( prayerDao.getCountByUser(userId) );
		pageVO.setData(prayerDao.findPageByUser(userId, rowBeginIndex, rowCount));
		return pageVO;
	}
	
	public Prayer load(int id){
		return prayerDao.load(id);
	}
}
